package gspushmq.v1.subscribe.handler.core;

import com.alibaba.fastjson.JSONArray;

import gspushmq.model.ApiMessageType;
import gspushmq.util.ToolsUtil;

public abstract class GGHandler implements Comparable<Object>, Runnable {

	/**
	 * 需要处理的数据
	 */
	private JSONArray array;
	
	/**
	 * 一类消息
	 */
	private ApiMessageType apiType;
	
	private Integer priority = 30;
	
	
	public JSONArray getArray() {
		return array;
	}
	public void setArray(JSONArray array) {
		this.array = array;
	}

	public ApiMessageType getApiType() {
		return apiType;
	}
	public void setApiType(ApiMessageType apiType) {
		this.apiType = apiType;
	}
	
	@Override
	public void run() {
		handler();
	}
	
	@Override
	public int compareTo(Object o) {
		Integer op = ToolsUtil.commonTo(o);
		return op.compareTo(this.getPriority());
	}
	
	public abstract void handler();
	public Integer getPriority() {
		return priority;
	}
	public void setPriority(Integer priority) {
		this.priority = priority;
	}
}
